package com.lanmaly.cunzheng;

import com.lanmaly.cunzheng.strategy.Calculator;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Administrator
 */
public class TestMain {
    public static void main(String[] args) {
        TestMain test = new TestMain();
        test.strategy();
        boolean flag = true;
        while (flag) {
            System.out.print("\n是否需要退出？(Y/N)");
            String input = getInput();
            if ("Y".equalsIgnoreCase(input)) {
                flag = false;
            } else if ("N".equalsIgnoreCase(input)) {
                System.out.println("N-------");
            } else {
                System.out.println("1----------1");
            }
        }
    }

    private static String getInput() {
        String str;
        try {
            str = (new BufferedReader(new InputStreamReader(System.in))).readLine();
        } catch (IOException e) {
            str = "N";
        }
        return str;
    }

    private void strategy() {
        int exec = Calculator.ADD.exec(10, 39);
        System.out.println(exec);

        System.out.println(Calculator.LESS.exec(10, 39));
    }
}
